package com.tianpengtech.common.validator.rules.string;

import org.apache.commons.lang.StringUtils;

import com.tianpengtech.common.exception.ValidateException;
import com.tianpengtech.common.validator.AbstractRule;

public class StringLengthGreaterThan extends AbstractRule {
    private int len;

    public StringLengthGreaterThan(String v, int len, String msg) {
        this.value = v;
        this.msg = msg;
        this.len = len;
    }

    @Override
    public boolean validate() throws ValidateException {

        String v = StringUtils.trim((String) this.value);
        if (StringUtils.length(v) <= this.len) {
            throw new ValidateException(this.msg);
        }
        return true;
    }
}
